var express = require('express')
var AnswerModel = require('../db/answerModel')

module.exports = function (req, res) {
    let id = req.params.id
    let {pin} = req.body
    AnswerModel.updateOne({id: parseInt(id)}, {$set: {pin: pin}}, function (error, answer) {
        if (error) {
            res.status(400).send({
                status: 400,
                message: "修改失败"
            })
        } else {
            res.send({
                status: 200,
                message: "修改成功"
            })
        }
    })
}